<div class="zs-body" data-ng-init="
    formInit('metadata', {
        keyField:'id',
        randomFields:['id'],
        orderObject:{order:0},
        pageSize:12
    });setConHei();">
    <div class="zs-map-tool">
        <div class="location">
            <a>首页</a>
            <i class="right-arr"></i>
            <a>运维管理</a>
            <i class="right-arr"></i>
            <a>元数据管理</a>
        </div>
        <div class="option">
            <input type="button" class="zs-btn orange" value="新建" 
                ng-click="addRow('metadata') && setMetaId('metadata') && openWindow('edit');"/>
            <input type="button" class="zs-btn orange" value="编辑" 
                ng-click="editRow('metadata', metadata.sRows[0]) && openWindow('edit')"/>
            <input type="button" class="zs-btn orange" value="删除 "
                ng-click="delEntitys('metadata')"/>
        </div>
    </div>
    <div class="zs-tree">
        <div class="zs-nice-tab idTabs">
            <div class="tool item" style="margin-left:6px;">
                <span class="search-warpper" style="width:230px">
                    <i class="icon"></i>
                    <input type="text" class="zs-input" placeholder="元数据名称" 
                        ng-model="dicTree.filterValue" 
                        ng-change="comboFilter('dicTree')"/>
                </span>
            </div>
        </div>
        <div style="margin-left: 15px;margin-top: 15px;margin-right: 15px;">
            <ag-Tree fn="dicTree"
                para="{ uDictionary:true,
                    dictionary:'f_metadata_directory',
                    checkbox:false,
                    showCode:true,
                    pidField:'pid',
                    leafField:'leaf',
                    intLoadLevel:2}"
                onselect="metaSearch"
                datafilter="metaFilter"
                ng-model='o'/>
        </div>
    </div>
    <div class="zs-content withTree" style="position:unset">
        <div class="zs-nice-tab idTabs">
            <div class="tool item" style="margin-left:6px;">
                
                <span class="search-warpper">
                    <i class="icon"></i>
                    <input type="text" class="zs-input" placeholder="元数据项名称" ng-model="metadata.queryObject['aliasName:like']"/>
                </span>
            </div>
            <div class="operation item">
                <a class="ope-1" ng-click="loadData('metadata')"></a>
                <a class="ope-2"></a>
            </div>
            <div class="switch">
            </div>
        </div>

        <div class="zs-data-table">
            <div class="container">
                <table>
                    <thead>
                        <tr>
                            <th>
                                <input id="allCheckbox" type="checkbox"
                                    ng-click="selectAll('metadata','allCheckbox');">
                            </th>
                            <th>序号</th>
                            <th>名称/别名</th>
                            <th>数据类型</th>
                            <th>主键/自动/为空/显示</th>
                            <th>长度/精度/默认值</th>
                            <th>字典域</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr ng-repeat="r in metadata.datas">
                            <td><input type="checkbox"
                                    ng-click="selectRow('metadata',r);"
                                    ng-model="r.selected" />
                            </td>
                            <td>
                                <a ng-click="editRow('metadata',r) && openWindow('edit');">
                                    <label ng-bind="r.order"></label>
                                </a>
                            </td>
                            <td>
                                <a ng-click="editRow('metadata',r) && openWindow('edit');">
                                    <label ng-bind="r.name"></label>(<label ng-bind="r.aliasName"></label>)
                                </a>
                            </td>
                            <td>
                                <a ng-click="editRow('metadata',r) && openWindow('edit');">
                                    <label ng-bind="r.dataTypeName"></label>
                                </a>
                            </td>

                            <td>
                                <a ng-click="editRow('metadata',r) && openWindow('edit');">
                                    <label ng-bind="r.key | asChineseBool"></label>
                                    /
                                    <label ng-bind="r.auto | asChineseBool"></label>
                                    /
                                    <label ng-bind="r.allowNull | asChineseBool"></label>
                                    /
                                    <label ng-bind="r.canShow | asChineseBool"></label>
                                </a>
                            </td>
                            
                            <td>
                                <a ng-click="editRow('metadata',r) && openWindow('edit');">
                                    <label ng-bind="r.maxlen"></label>
                                    /
                                    <label ng-bind="r.decimaldigits"></label>
                                    /
                                    <label ng-bind="r.defaultValue"></label>
                                </a>
                            </td>
                            <td>
                                <a ng-click="editRow('metadata',r) && openWindow('edit');">
                                    <label ng-bind="r.dictionaryName"></label>
                                </a>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
        <div class="zs-pagination-box">
            <ag-Page fn='metadata'></ag-Page>
        </div>

        <div ag-Window id="edit" title="元数据项编辑" width='560px' height='240px'>
            <div class="zs-form-tab ibox">
                <form name="form" novalidate>
                    <table width="100%">
                        <tbody>
                            <tr>
                                <td class="text" width="20%">序号</td>
                                <td class="left" width="30%"><input type="text"
                                    class="zs-input" ng-model="metadata.editRow.order"></td>
                                <td class="text" width="20%">*名称</td>
                                <td class="left" width="30%"><input type="text"
                                    ng-model="metadata.editRow.name"
                                    class="zs-input" required></td>
                            </tr>
                            <tr>
                                <td class="text" width="20%">*别名</td>
                                <td class="left" width="30%"><input type="text"
                                    ng-model="metadata.editRow.aliasName"
                                    class="zs-input" required></td>
                                <td class="text" width="20%">数据类型</td>
                                <td class="left" width="30%">
                                    <ag-Combobox class="zs-input" style="width:175px;height:28px;"
                                        para="{uDictionary:true,dictionary:'f_datatype'}"
                                        ng-model="metadata.editRow.dataType"
                                        text-Value="metadata.editRow.dataTypeName" />
                                </td>
                            </tr>
                            <tr>
                                <td class="text" width="20%"></td>
                                <td colspan="3" class="left" width="80%">
                                    <input type="checkbox" ng-model="metadata.editRow.key"
                                        ng-true-value="true" ng-false-value="false" value='false' />
                                    主健 
                                    <input type="checkbox" ng-model="metadata.editRow.auto"
                                        ng-true-value="true" ng-false-value="false" value='false' />
                                    自动增值
                                    <input type="checkbox" ng-model="metadata.editRow.allowNull"
                                        ng-true-value="true" ng-false-value="false" value='false' />
                                    允许为空
                                    <input type="checkbox" ng-model="metadata.editRow.canShow"
                                        ng-true-value="true" ng-false-value="false" value='false' />
                                    是否显示
                                </td>
                            </tr>
                            <tr>
                                <td class="text" width="20%">长度</td>
                                <td class="left" width="30%"><input type="text"
                                    ng-model="metadata.editRow.maxlen"
                                    class="zs-input"></td>
                                <td class="text" width="20%">精度</td>
                                <td class="left" width="30%"><input type="text"
                                    ng-model="metadata.editRow.decimaldigits"
                                    class="zs-input"></td>
                            </tr>
                            <tr>
                                <td class="text" width="20%">字典域</td>
                                <td class="left" width="30%"><input type="text"
                                    ng-model="metadata.editRow.dictionaryName"
                                    class="zs-input"></td>
                                <td class="text" width="20%">默认值</td>
                                <td class="left" width="30%"><input type="text"
                                    ng-model="metadata.editRow.defaultValue"
                                    class="zs-input"></td>
                            </tr>
                        </tbody>
                        <tfoot>
                            <tr>
                                <td colspan="4">
                                    <input type="button" name="ok" value="保存" class="zs-btn c-red"
                                        ng-click="formValidate(form) && save('metadata', metadata.editRow, saveCloseWindow)"/>
                                    <input type="button" name="ok" value="取消" class="zs-btn c-green" 
                                        ng-click="closeWindow('edit')" />
                                </td>
                            </tr>
                        </tfoot>
                    </table>
                </form>
            </div>
        </div>
    </div>
</div>